<div class="page_title">
    <span class="title_icon"><span class="blocks_images"></span></span>
    <h3><strong> CATEGORIA:</strong>  <?php echo $subclaseslaboratorio; ?></h3>    
</div>
<div id="content">
    <div class="grid_container">
        <div class="grid_8">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6><strong>RANGOS DEL LABORATORIO: </strong> <?php echo $nombre; ?></h6>
                </div>
                <div class="widget_content">                    
                    <table class="display data_tbl">
                        <thead>
                            <tr>
                                <th>Num</th>                                        
                                <th>RangoInicial</th>
                                <th>RangoFinal</th>
                                <th>Sexo</th>   
                                <th>Rango(Solo para rangos variables</th>
                                <th>Unidad Medida</th>                                
                                <th>Acciones</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $i = 1;
                            foreach ($rangos as $p):
                                ?>
                                <tr class="gradeA">
                                    <td><?php echo $i; ?> </td> 
                                    <td><?php echo h($p['Laboratoriosrango']['rangoinicial']); ?></td>
                                    <td><?php echo h($p['Laboratoriosrango']['rangofinal']); ?></td>
                                    <td>
                                        <?php if (empty($p['Laboratoriosrango']['sexo'])): ?>
                                            Ninguno
                                        <?php elseif ($p['Laboratoriosrango']['sexo'] == 'M'): ?>
                                            Masculino
                                        <?php else: ?>
                                            Femenino
                                        <?php endif; ?>
                                    </td>
                                    <td>

                                        <?php if ($p['Laboratoriosrango']['rango'] == null){
                                            echo "Valida segun los parametros inicial y final";
                                        }else{
                                            if ($p['Laboratoriosrango']['rango'] == 1)
                                              echo "Dentro";
                                           else
                                              echo "Fuera";
                                            
                                        }?> 
                                         
                                    </td>
                                    <td><?php echo h($p['Laboratoriosrango']['descripcion']); ?></td>
                                    <td>
                                        <?php echo $this->Ajax->link('EDITAR', array('action' => 'ajaxeditarrango', $p['Laboratoriosrango']['id']), array('update' => 'cargaedit', 'title' => 'Edicion de datos', 'escape' => false)); ?>
                                        &nbsp;
                                        <?php echo $this->Html->link('ELIMINAR', array('action' => 'deleterango', $p['Laboratoriosrango']['id'], $p['Laboratoriosrango']['laboratorio_id']), null, 'esta seguro de eliminar el rango # ' . $i . '?') ?>
                                    </td> 
                                </tr>                           
    <?php
    $i++;
endforeach;
?>
                        </tbody>

                    </table>
                </div>
            </div>
        </div>
        <div class="grid_4">
            <div  id="cargaedit">
                <div class="widget_wrap">
                    <div class="widget_top">
                        <span class="h_icon list"></span>
                        <h6>Rangos de: <?php echo $nombre; ?></h6>
                    </div>
                    <div class="widget_content">                    
<?php echo $this->Form->create('Laboratorio', array('action' => 'rangos', 'id' => 'regitstraion_form', 'class' => 'form_container left_label')); ?>
                        <?php echo $this->form->hidden('Laboratoriosrango.laboratorio_id', array('value' => $id)) ?>
                        <ul>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title" for="password">RangoInicial <span class="req">*</span></label>
                                    <div class="form_input">
<?php echo $this->Form->text('Laboratoriosrango.rangoinicial', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title" for="password">RangoFinal <span class="req">*</span></label>
                                    <div class="form_input">                                
<?php echo $this->Form->text('Laboratoriosrango.rangofinal', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title" for="password">Tipo de Rango<span class="req">(Solo para rangos variables)</span></label>
                                    <div class="form_input">   
<?php echo $this->Form->select('Laboratoriosrango.rango', array(' ' => 'Ninguno', '0' => 'Fuera', '1' => 'Dentro'), array('tabindex' => 1)); ?>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title" for="password">Sexo[F / M]</label>
                                    <div class="form_input">                                
<?php //echo $this->Form->text('Laboratoriosrango.sexo', array('tabindex' => 1));  ?>
                                        <?php echo $this->Form->select('Laboratoriosrango.sexo', array('' => 'Ambos', 'F' => 'Femenino', 'M' => 'Masculino'), array('tabindex' => 1)); ?>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <label class="field_title" for="password">Unidad de Medida</label>
                                    <div class="form_input">                                
<?php echo $this->Form->text('Laboratoriosrango.descripcion', array('tabindex' => 1)); ?>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <div class="form_grid_12">
                                    <div class="form_input">
                                        <button type="submit" class="btn_small btn_blue"><span>Registrar</span></button>
                                        <button type="reset" class="btn_small btn_blue"><span>Limpiar datos</span></button>
<?php echo $this->Html->link('ATRAS', array('action' => 'index'), array('escape' => false)); ?>  
                                    </div>
                                </div>
                            </li>
                        </ul>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
